<?php
if($_POST){
	foreach ($_POST as $key=>$val){		
		if($key != 'acao' && $key != 'pagina' && $key != '_method'){
			if(!is_array($val)){
				$parametros[$key] = $val;
			}else{
				foreach ($val as $a){
					$parametros[$key][] = $a;
				}
			}
		}
	}
	if($_FILES){
		foreach($_FILES as $file) { 
	    	$parametros['files'][] = $file; 
		}
	}
	require_once 'control.class.php';
	$acao   = $_POST['acao'];
	$pagina = $_POST['pagina'];
	$ist = new Control($acao, $pagina, $parametros);
	switch($acao){
		case 'insert':
			$ist->Insert();
			break;
		case 'update':
			$ist->Update();
			break;
		case 'delete':
			$ist->Delete();
			break;
		case 'autenticar':
			$ist->Insert();
			break;
		case 'indicacao':
			$ist->Insert();
			break;
		case 'informacoes':
			$ist->Insert();
			break;
		case 'espec':
			$ist->Consult();
			break;
	}
	echo $ist->result->lista;
}
?>